package m07;

import javax.imageio.ImageIO;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JLabel;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;

import javax.swing.JButton;

import m06.SolarSystem;
import m08.MapPanel;
import m09.Global;


/**
 * 
 * @author Jessica Roberts, Samantha Rich and Kate Harlan
 * @version 3.2 13 November 2012
 *
 */
public class GamePanel extends JPanel{
	private static final long serialVersionUID = -6486824438404941954L;
	private int money;
    private Ship ship= new Ship("flea",10);
	private JButton waterToSell,gamesToSell,oreToSell,foodToSell,furToSell,fireToSell,robotsToSell,machineToSell,medsToSell,narcToSell,
		narcToBuy,medsToBuy,machinesToBuy,robotToBuy,fireToBuy,furToBuy,foodToBuy,oreToBuy,gamesToBuy,waterToBuy;
	private JLabel lblName, lblPilot, lblTrader, lblFighter, lblEngineer, lblMoney, lblSS, lblFuel;
	public JLabel waterP, fursP, foodP, oreP, gamesP, firearmsP, medicineP, machinesP, narcoticsP, robotsP;
	@SuppressWarnings("unused")
	private SolarSystem ss01, ss02, ss03, ss04, ss05, ss06, ss07, ss08, ss09;
	public Good waterGood, furGood, foodGood, oreGood, gamesGood, fireGood, medsGood, machineGood, narcGood, robotGood;
	private JButton btnSaveGame, btnQuitGame;
	private JButton btnBuyFuel;
	public MapPanel map; 
	private Icon shipIcon;
	 
	/**
	 * Create the panel.
	 * @param boolean isForTrader true if it's for a trader, false otherwise
	 */
	public GamePanel() {
		money = 1000;
		activateGoods();
		activateSolarSystem();
		setLayout(null);
		
		BufferedImage shipImg;
		try {
			ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
			InputStream input = classLoader.getResourceAsStream("ship.png");
			shipImg = ImageIO.read(input);
			shipIcon = new ImageIcon(shipImg);
		} catch (IOException e) {
			e.printStackTrace();
			System.out.println("Icon Not Loaded");
		}
  
		lblPilot = new JLabel("Pilot: ");
		lblPilot.setBounds(20, 24, 132, 16);
		lblPilot.setForeground(Color.white);
		add(lblPilot);
  
		lblName = new JLabel("Name: ");
		lblName.setBounds(20, 6, 132, 21);
		lblName.setForeground(Color.white);
		add(lblName);
  
		lblFighter = new JLabel("Fighter: ");
		lblFighter.setBounds(20, 41, 132, 16);
		lblFighter.setForeground(Color.white);
		add(lblFighter);
  
		lblTrader = new JLabel("Trader: ");
		lblTrader.setBounds(20, 58, 132, 16);
		lblTrader.setForeground(Color.white);
		add(lblTrader);
  
		lblEngineer = new JLabel("Engineer: ");
		lblEngineer.setBounds(20, 74, 132, 16);
		lblEngineer.setForeground(Color.white);
		add(lblEngineer);
  
		lblMoney = new JLabel("Money: " + money);
		lblMoney.setBounds(20, 90, 132, 16);
		lblMoney.setForeground(Color.white);
		add(lblMoney);
		
		lblFuel = new JLabel("Fuel: " + ship.getFuel());
		lblFuel.setBounds(20, 106, 132, 16);
		lblFuel.setForeground(Color.white);
		add(lblFuel);
  
		JLabel lblWater = new JLabel("Water");
		lblWater.setBounds(220, 20, 35, 16);
		lblWater.setForeground(Color.white);
		add(lblWater);
  
		JLabel lblFurs = new JLabel("Furs");
		lblFurs.setBounds(227, 100, 27, 16);
		lblFurs.setForeground(Color.white);
		add(lblFurs);
  
		JLabel lblFood = new JLabel("Food");
		lblFood.setBounds(224, 82, 31, 16);
		lblFood.setForeground(Color.white);
	 	add(lblFood);
	  
		JLabel lblOre = new JLabel("Ore");
		lblOre.setBounds(233, 61, 22, 16);
		lblOre.setForeground(Color.white);
		add(lblOre);
	  
		JLabel lblGames = new JLabel("Games");
	  	lblGames.setBounds(213, 41, 42, 16);
	  	lblGames.setForeground(Color.white);
	  	add(lblGames);
	  
	  	JLabel lblFirearms = new JLabel("Firearms");
	  	lblFirearms.setBounds(201, 118, 54, 16);
	  	lblFirearms.setForeground(Color.white);
	  	add(lblFirearms);
	  
	  	JLabel lblRobots = new JLabel("Robots");
	  	lblRobots.setBounds(210, 200, 44, 16);
	  	lblRobots.setForeground(Color.white);
	  	add(lblRobots);
	  
	  	JLabel lblMachines = new JLabel("Machines");
	  	lblMachines.setBounds(195, 179, 59, 16);
	  	lblMachines.setForeground(Color.white);
	  	add(lblMachines);
	  
	  	JLabel lblMedicine = new JLabel("Medicine");
	  	lblMedicine.setBounds(195, 160, 56, 16);
	  	lblMedicine.setForeground(Color.white);
	  	add(lblMedicine);
  
	  	JLabel lblNarcotics = new JLabel("Narcotics");
	  	lblNarcotics.setBounds(194, 140, 60, 16);
	  	lblNarcotics.setForeground(Color.white);
	  	add(lblNarcotics);
	  
	  	waterToSell = new JButton(ship.getGoodAmount("water"));
	  	waterToSell.setBounds(258, 20, 28, 20);
	  	waterToSell.addActionListener(new ButtonListener("water", 1));
	  	add(waterToSell);
	  
	  	gamesToSell = new JButton(ship.getGoodAmount("games"));
	  	gamesToSell.setBounds(258, 39, 28, 21);
	  	gamesToSell.addActionListener(new ButtonListener("games", 1));
	  	add(gamesToSell);
	  
	  	oreToSell = new JButton(ship.getGoodAmount("ore"));
	  	oreToSell.setBounds(258, 59, 28, 21);
	  	oreToSell.addActionListener(new ButtonListener("ore", 1));
	  	add(oreToSell);
	  	
	  	foodToSell = new JButton(ship.getGoodAmount("food"));
	  	foodToSell.setBounds(258, 79, 28, 20);
	  	foodToSell.addActionListener(new ButtonListener("food", 1));
	  	add(foodToSell);
	  
	  	furToSell = new JButton(ship.getGoodAmount("furs"));
	  	furToSell.setBounds(258, 98, 28, 21);
	  	furToSell.addActionListener(new ButtonListener("furs", 1));
	  	add(furToSell);
  
	  	fireToSell = new JButton(ship.getGoodAmount("firearms"));
	  	fireToSell.setBounds(258, 118, 28, 21);
	  	fireToSell.addActionListener(new ButtonListener("firearms", 1));
	  	add(fireToSell);
  
	  	narcToSell = new JButton(ship.getGoodAmount("robots"));
	  	narcToSell.setBounds(258, 138, 28, 21);
	  	narcToSell.addActionListener(new ButtonListener("robots", 1));
	  	add(narcToSell);
    
	  	medsToSell = new JButton(ship.getGoodAmount("medicine"));
	  	medsToSell.setBounds(258, 158, 28, 20);
	  	medsToSell.addActionListener(new ButtonListener("medicine", 1));
	  	add(medsToSell);
  
	  	machineToSell = new JButton(ship.getGoodAmount("machines"));
	  	machineToSell.setBounds(258, 177, 28, 21);
	  	machineToSell.addActionListener(new ButtonListener("machines", 1));
	  	add(machineToSell);
  
	  	robotsToSell = new JButton(ship.getGoodAmount("medicine"));
	  	robotsToSell.setBounds(258, 197, 28, 21);
	  	robotsToSell.addActionListener(new ButtonListener("medicine", 1));
	  	add(robotsToSell);

  
	  	waterGood.updatePrice(1);
	  	furGood.updatePrice(1);
	  	foodGood.updatePrice(1);
	  	oreGood.updatePrice(1);
	  	gamesGood.updatePrice(1);
	  	fireGood.updatePrice(1);
	  	medsGood.updatePrice(1);
	  	machineGood.updatePrice(1);
	  	narcGood.updatePrice(1);
	  	robotGood.updatePrice(1);
  
	  	JLabel lblSell = new JLabel("Sell");
	  	lblSell.setBounds(263, 3, 61, 16);
	  	lblSell.setForeground(Color.white);
	  	add(lblSell);
  
	  	waterToBuy = new JButton("" + money/waterGood.getCurrentPrice());
	  	waterToBuy.setBounds(313, 20, 28, 20);
	  	waterToBuy.addActionListener(new ButtonListener("water", -1));
	  	add(waterToBuy);
  
	  	gamesToBuy = new JButton("" + money/gamesGood.getCurrentPrice());
	  	gamesToBuy.setBounds(313, 39, 28, 21);
	  	gamesToBuy.addActionListener(new ButtonListener("games", -1));
	  	add(gamesToBuy);
  
	  	oreToBuy = new JButton("" + money/oreGood.getCurrentPrice());
	  	oreToBuy.setBounds(313, 59, 28, 21);
	  	oreToBuy.addActionListener(new ButtonListener("ore", -1));
	  	add(oreToBuy);
  
	  	foodToBuy = new JButton("" + money/foodGood.getCurrentPrice());
	  	foodToBuy.setBounds(313, 79, 28, 20);
	  	foodToBuy.addActionListener(new ButtonListener("food", -1));
	  	add(foodToBuy);
  
	  	furToBuy = new JButton("" + money/furGood.getCurrentPrice());
	  	furToBuy.setBounds(313, 98, 28, 21);
	  	furToBuy.addActionListener(new ButtonListener("furs", -1));
	  	add(furToBuy);
  
	  	fireToBuy = new JButton("" + money/fireGood.getCurrentPrice());
	  	fireToBuy.setBounds(313, 118, 28, 21);
	  	fireToBuy.addActionListener(new ButtonListener("firearms", -1));
	  	add(fireToBuy);
  
	  	narcToBuy = new JButton("" + money/narcGood.getCurrentPrice());
	  	narcToBuy.setBounds(313, 138, 28, 21);
	  	narcToBuy.addActionListener(new ButtonListener("narcotics", -1));
	  	add(narcToBuy);
  
	  	medsToBuy = new JButton("" + money/medsGood.getCurrentPrice());
	  	medsToBuy.setBounds(313, 158, 28, 20);
	  	medsToBuy.addActionListener(new ButtonListener("medicine", -1));
	  	add(medsToBuy);
  
	  	machinesToBuy = new JButton("" + money/machineGood.getCurrentPrice());
	  	machinesToBuy.setBounds(313, 177, 28, 21);
	  	machinesToBuy.addActionListener(new ButtonListener("machines", -1));
	  	add(machinesToBuy);
  
	  	robotToBuy = new JButton("" + money/robotGood.getCurrentPrice());
	  	robotToBuy.setBounds(313, 197, 28, 21);
	  	robotToBuy.addActionListener(new ButtonListener("robots", -1));
	  	add(robotToBuy);
  
	  	waterP = new JLabel(waterGood.getCurrentPrice() +" credits");
	  	waterP.setBounds(350, 20, 150, 21);
	  	waterP.setForeground(Color.white);
	  	add(waterP);
    
	  	gamesP = new JLabel(gamesGood.getCurrentPrice() +" credits");
	  	gamesP.setBounds(350, 39, 150, 21);
	  	gamesP.setForeground(Color.white);
	  	add(gamesP);
    
	  	oreP = new JLabel(oreGood.getCurrentPrice() +" credits");
	  	oreP.setBounds(350, 59, 150, 21);
	  	oreP.setForeground(Color.white);
	  	add(oreP);
    
	  	foodP = new JLabel(foodGood.getCurrentPrice() +" credits");
	  	foodP.setBounds(350, 79, 150, 21);
	  	foodP.setForeground(Color.white);
	  	add(foodP);
  
	  	fursP = new JLabel(furGood.getCurrentPrice() +" credits");
	  	fursP.setBounds(350, 98, 150, 21);
	  	fursP.setForeground(Color.white);
	  	add(fursP);
  
	  	firearmsP = new JLabel(fireGood.getCurrentPrice() +" credits");
	  	firearmsP.setBounds(350, 118, 150, 21);
	  	firearmsP.setForeground(Color.white);
	  	add(firearmsP);
  
	  	narcoticsP = new JLabel(narcGood.getCurrentPrice() +" credits");
	  	narcoticsP.setBounds(350, 138, 150, 21);
	  	narcoticsP.setForeground(Color.white);
	  	add(narcoticsP);
  
	  	medicineP = new JLabel(medsGood.getCurrentPrice() +" credits");
	  	medicineP.setBounds(350, 158, 150, 21);
	  	medicineP.setForeground(Color.white);
	  	add(medicineP);
  
	  	machinesP = new JLabel(machineGood.getCurrentPrice() +" credits");
	  	machinesP.setBounds(350, 177, 150, 21);
	  	machinesP.setForeground(Color.white);
	  	add(machinesP);
  
	  	robotsP = new JLabel(robotGood.getCurrentPrice() +" credits");
	  	robotsP.setBounds(350, 197, 150, 21);
	  	robotsP.setForeground(Color.white);
	  	add(robotsP);
  
	  	JLabel lblBuy = new JLabel("Buy");
	  	lblBuy.setBounds(315, 2, 61, 16);
	  	lblBuy.setForeground(Color.white);
	  	add(lblBuy);
  
	  	btnSaveGame = new JButton("Save Game");
        btnSaveGame.setBounds(450, 15, 117, 29);
        add(btnSaveGame);
        btnSaveGame.addActionListener(new SaveGameListener());
        
        btnQuitGame = new JButton("Quit");
        btnQuitGame.setBounds(450, 45, 117, 29);
        add(btnQuitGame);
        btnQuitGame.addActionListener(new QuitGameListener());
        
        btnBuyFuel = new JButton("Buy Fuel");
	  	btnBuyFuel.setBounds(15, 125, 117, 29);
	  	add(btnBuyFuel);
	  	btnBuyFuel.addActionListener(new BuyFuelListener());
        
		map = new MapPanel(this);
	  	add(map);
	  	map.setLocation(0, 250);
	  	
	} // end constructor
	
	/**
	 * gets the game panel
	 * @return the game panel
	 */
	public GamePanel getGamePanel(){
		return GamePanel.this;
	} // end method getGamePanel
	
	/**
	 * 
	 * @author kateharlan
	 *
	 */
	public class BuyFuelListener implements ActionListener{

		/**
		 * 
		 */
		@Override
		public void actionPerformed(ActionEvent arg0) {
			int fuel = Global.currentPlayer.getShip().getFuel();
			if(Global.currentPlayer.getMoney()-100 >= 0){
				fuel = fuel + 10;
				Global.currentPlayer.getShip().setFuel(fuel);
				Global.currentPlayer.setMoney(Global.currentPlayer.getMoney() -100);
				updateMoney();
				updateFuel();
			}
			else {
				JOptionPane.showMessageDialog(null, "You don't have enough money to buy more fuel!", "Message", JOptionPane.INFORMATION_MESSAGE, shipIcon);
				//JOptionPane.showMessageDialog(null, "You don't have enough money to buy more fuel!");	
			}
		}
		
	}
	
	public class QuitGameListener implements ActionListener{

		/**
		 * 
		 */
		@Override
		public void actionPerformed(ActionEvent arg0) {
			System.exit(0);
		}
		
	}
	
	
	/**
	 * a button listener for the save game button
	 * @author Kate Harlan
	 * @version 1.0 10 November 2012
	 */
	public class SaveGameListener implements ActionListener{

		/**
		 * saves the game to the arraylist of saved games and as its own files
		 */
		@SuppressWarnings("unchecked")
		@Override
		public void actionPerformed(ActionEvent arg0) {
			ArrayList<Player> myPlayerList;
			try {
				FileInputStream fileIn = new FileInputStream("gameList.ser");
	            ObjectInputStream in = new ObjectInputStream(fileIn);
	            myPlayerList = (ArrayList<Player>) in.readObject();
	            in.close();
	            fileIn.close();
	        } // end try
			catch(Exception e){
				System.err.println("Caught IOException: " + e.getMessage());
				myPlayerList = new ArrayList<Player>();
				e.printStackTrace();
			} // end catch
			int overwriteme=-1;
			for (int i = 0; i<myPlayerList.size(); i++) {
				if ((myPlayerList.get(i).getName()).equals(Global.currentPlayer.getName())){
					overwriteme=i;
					myPlayerList.set(i, Global.currentPlayer);
				} // end if statement
			} // end for loop
			if (overwriteme == -1){
				myPlayerList.add(Global.currentPlayer);
			} // end if statement

			try {
				FileOutputStream fileOut = new FileOutputStream("gameList.ser");
		        ObjectOutputStream out = new ObjectOutputStream(fileOut);
		        out.writeObject(myPlayerList);
		        out.close();
		        fileOut.close();
				
		        ArrayList<Integer> mapData = new ArrayList<Integer>();
		        mapData.add(map.marketLevel());
		        mapData.add(map.getCurrentSys());
		        
				fileOut = new FileOutputStream(Global.currentPlayer.getName() + "_map.ser");
		        out = new ObjectOutputStream(fileOut);
		        out.writeObject(mapData);
		        out.close();
		        fileOut.close();
		        		        
		    } // end try
			catch(IOException i)
		    {
		        i.printStackTrace();
		        System.out.println("Can't Save Game");
		    } // end catch
			
		} // end method actionPerformed
		
	} // end class SaveGameListener
	
	/**
	 * button listener for buying and selling.
	 * @author kateharlan
	 * @version 1.0 10 November 2012
	 */
	private class ButtonListener implements ActionListener{
		int action;
		String goodName;
  
		/**
		 * a constructor
		 * @param goodName
		 * @param action
		 */
		public ButtonListener(String goodName, int action){
			this.action=action;
			this.goodName=goodName;
		} // end constructor
		
		/**
		 * makes buying and selling buttons work.
		 */
		@Override
		public void actionPerformed(ActionEvent e)
		{
			if (action==-1){ //This is the same as buying
				Good good = Global.currentPlayer.getShip().goodConverter(goodName);//need to pass in the good name
				good.updatePrice(map.marketLevel()); //We DID dynamically get the tech level
    
				if((Global.currentPlayer.getMoney()-good.getCurrentPrice()) > 0)
				{
					boolean x = Global.currentPlayer.getShip().addCargo(good);
					if (x == false){
						JOptionPane.showMessageDialog(null, "Your ship's cargo hold is full!", "Message", JOptionPane.INFORMATION_MESSAGE, shipIcon);
						//JOptionPane.showMessageDialog(null, "Your ship's cargo hold is full!");	
					}
					else {
						Global.currentPlayer.setMoney(Global.currentPlayer.getMoney() - good.getCurrentPrice());
					}
					updateMoney();
				} // end nested if statement
				else {
					JOptionPane.showMessageDialog(null, "You don't have enough money to buy this item!", "Message", JOptionPane.INFORMATION_MESSAGE, shipIcon);
				} // end nested else
				updateSellButtons();
				updateBuyButtons();
			} // end if statement
			else if (action==1){//We are selling 
				if(Global.currentPlayer.getShip().contains(goodName))
				{
					Global.currentPlayer.getShip().removeCargo(goodName);
					Good good = Global.currentPlayer.getShip().goodConverter(goodName);
					good.updatePrice(map.marketLevel());
					Global.currentPlayer.setMoney(Global.currentPlayer.getMoney() + good.getCurrentPrice());
					updateMoney();
				} // end nested if statement
				else {
					JOptionPane.showMessageDialog(null, "You can't sell an item you don't have!", "Message", JOptionPane.INFORMATION_MESSAGE, shipIcon);
				} // end nested else
				updateBuyButtons();
				updateSellButtons();
			} // end else if
		} // end method actionPerformed
	} // end class ButtonListener
 
	/**
	 * loads the text for the sell buttons.
	 */
	public void updateSellButtons()
	{
		waterToSell.setText(Global.currentPlayer.getShip().getGoodAmount("water"));
		furToSell.setText(Global.currentPlayer.getShip().getGoodAmount("furs"));
		foodToSell.setText(Global.currentPlayer.getShip().getGoodAmount("food"));
		oreToSell.setText(Global.currentPlayer.getShip().getGoodAmount("ore"));
		gamesToSell.setText(Global.currentPlayer.getShip().getGoodAmount("games"));
		fireToSell.setText(Global.currentPlayer.getShip().getGoodAmount("firearms"));
		robotsToSell.setText(Global.currentPlayer.getShip().getGoodAmount("robots"));
		machineToSell.setText(Global.currentPlayer.getShip().getGoodAmount("machines"));
		medsToSell.setText(Global.currentPlayer.getShip().getGoodAmount("medicine"));
		narcToSell.setText(Global.currentPlayer.getShip().getGoodAmount("narcotics"));
	} // end method updateSellButtons
 
	/**
	 * loads the text for the buy buttons.
	 */
	public void updateBuyButtons()
	{
		waterToBuy.setText("" + Global.currentPlayer.getMoney()/waterGood.getCurrentPrice());
		gamesToBuy.setText("" + Global.currentPlayer.getMoney()/gamesGood.getCurrentPrice());
		oreToBuy.setText("" + Global.currentPlayer.getMoney()/oreGood.getCurrentPrice());
		foodToBuy.setText("" + Global.currentPlayer.getMoney()/foodGood.getCurrentPrice());
		furToBuy.setText("" + Global.currentPlayer.getMoney()/furGood.getCurrentPrice());
		fireToBuy.setText("" + Global.currentPlayer.getMoney()/fireGood.getCurrentPrice());
		narcToBuy.setText("" + Global.currentPlayer.getMoney()/narcGood.getCurrentPrice());
		medsToBuy.setText("" + Global.currentPlayer.getMoney()/medsGood.getCurrentPrice());
		machinesToBuy.setText("" + Global.currentPlayer.getMoney()/machineGood.getCurrentPrice());
		robotToBuy.setText("" + Global.currentPlayer.getMoney()/robotGood.getCurrentPrice());
	} // end method updateBuyButtons
 
	/**
	 * loads the text for the buy buttons.
	 */
	public void updateLabels()
	{
		waterP.setText(waterGood.getCurrentPrice() +" credits");
		gamesP.setText(gamesGood.getCurrentPrice() +" credits");
		oreP.setText(oreGood.getCurrentPrice() +" credits");
		foodP.setText(foodGood.getCurrentPrice() +" credits");
		fursP.setText(furGood.getCurrentPrice() +" credits");
		firearmsP.setText(fireGood.getCurrentPrice() +" credits");
		narcoticsP.setText(narcGood.getCurrentPrice() +" credits");
		medicineP.setText(medsGood.getCurrentPrice() +" credits");
		machinesP.setText(machineGood.getCurrentPrice() +" credits");
		robotsP.setText(robotGood.getCurrentPrice() +" credits");
	} // end method updateLabels
	
	/**
	 * sets up the player
	 * @param p a player
	 */
	public void updatePlayer()
	{
		Player p = Global.currentPlayer;
		lblName.setText("Name: " + p.getName()); 
		lblPilot.setText("Pilot: " + p.getPilot());
		lblTrader.setText("Trader: " + p.getTrader());
		lblFighter.setText("Fighter: " + p.getFighter());
		lblEngineer.setText("Engineer: " + p.getEngineer());
		ship = Global.currentPlayer.getShip();
	} // end method updatePlayer
 
	/**
	 * updates the money label
	 */
	public void updateMoney()
	{
		money = Global.currentPlayer.getMoney();
		lblMoney.setText("Money: " + money);
	} // end method updateMoney
	
	/**
	 * updates the fuel label
	 */
	public void updateFuel()
	{
		lblFuel.setText("Fuel: " + Global.currentPlayer.getShip().getFuel());
	} // end method updateFuel
 
	/**
	 * updates the current solar system label
	 * @param s the solar system
	 */
	public void updateSS(SolarSystem s)
	{
		lblSS.setText("Solar System: " + s.getName());
	} // end method updateSS(SS)
	
	public void setTrader(int traderPoints){
		lblTrader.setText("Trader: " + traderPoints);
	} // end method setTrader(int)
	
	public void setPilot(int pilotPoints){
		lblPilot.setText("Pilot: " + pilotPoints);
	} // end method setPilot(int)
	
	public void setEngineer(int engineerPoints){
		lblEngineer.setText("Engineer: " + engineerPoints);
	} // end method setEngineer(int)
	
	public void setFighter(int fighterPoints){
		lblFighter.setText("Fighter: " + fighterPoints);
	} // end method setFighter(int)
 
	/**
	 * sets up the solar system to hardcoded locations
	 */
	public void activateSolarSystem() {
		ss01 = new SolarSystem("Titan", 50, 50, "Industrial", 
				"MINERALRICH", "WEIRDMUSHROOMS");
		ss02 = new SolarSystem("Demeter", 175, 100, "Agriculture", 
				"RICHSOIL", "RICHFAUNA", "LOTSOFHERBS");
		ss03 = new SolarSystem("Apollo", 100, 100, "Early Industrial", 
				"LOTSOFWATER", "POORSOIL", "WARLIKE");
		ss04 = new SolarSystem("Schwagger", 5, 195, "Post Industrial", 
				"LOTSOFWATER", "WEIRDMUSHROOMS", "ARTISTIC");
		ss05 = new SolarSystem("Argus", 160, 175, "Pre-Agriculture", 
				"POORSOIL", "LIFELESS", "LOTSOFHERBS");
		ss06 = new SolarSystem("Nix", 45, 120, "Renaissance", 
				"RICHFAUNA", "ARTISTIC");
		ss07 = new SolarSystem("Xerox", 120, 190, "Hi-Tech", 
				"MINERALPOOR", "POORSOIL", "ARTISTIC");
		ss08 = new SolarSystem("Isis", 10, 140, "Agriculture", "DESERT",
				"RICHSOIL");
		ss09 = new SolarSystem("Brax", 75, 125, "Medieval", "DESERT", 
				"WARLIKE");
	}
 
	/**
	 * sets up all the goods
	 */
	public void activateGoods() {
		waterGood = new Good ("Water", 0, 0, 30, 3, 4, "LOTSOFWATER", "DESERT", 30, 50, 0);
		furGood = new Good ("Furs", 0, 0, 250, 10, 10, "RICHFAUA", "LIFELESS", 230, 280, 0);
		foodGood = new Good ("Food", 1, 0, 100, 5, 5, "RICHSOIL", "POORSOIL", 90, 160, 0);
		oreGood = new Good ("Ore", 2, 2, 350, 20, 10, "MINERALRICH", "MINERALPOOR", 350, 420, 0);
		gamesGood = new Good ("Games", 3, 1, 250, -10, 5, "ARTISTIC", null, 160, 270, 0);
		fireGood = new Good ("Firearms", 3, 1, 1250, -75, 100, "WARLIKE", null, 600, 1100, 0);
		medsGood = new Good ("Medicine", 4, 1, 650, -20, 10, "LOTSOFHERBS", null, 400, 700, 0);
		machineGood = new Good ("Machines", 4, 3, 900, -30, 5, null, null, 600, 800, 0);
		narcGood = new Good ("Narcotics", 5, 0, 3500, -125, 150, "WEIRDMUSHROOMS", null, 2000, 3000, 0);
		robotGood = new Good ("Robots", 6, 4, 5000, -150, 100, null, null, 3500, 5000, 0);
	} // end method activateGoods
	
	public void setMapPanel(MapPanel mp){
		map = mp;
	}
	
	public MapPanel getMapPanel(){
		return map;
	}
} // end class GamePanel
